using System;
using CUtil;
namespace CStock
{
	

	/// <summary>
	/// Summary description for QuoteWeb.
	/// </summary>
    public class QuoteWeb : QuoteIntraday, IQuoteWeb
	{
		private double lastPrice;
		private int lastSIZE;
		private int wkn;
		private int tickType;
		
		
       
		private DateTime timeLastTransaction;
		

		private string symbol;
		
		
		private Int64 volumeTotal;

	
		private int bidSize;
		private int askSize;

		private double cLOSE_PRICE;
		private double oPEN_PRICE;
	
		#region properties

		public QuoteWeb()
		{
			
		}

		public double LastPrice
		{
			get
			{
				return this.lastPrice;
			}
			set
			{
				this.lastPrice = value;
			}
		}
       
		

		[System.Xml.Serialization.XmlIgnoreAttribute()]
		public int LAST_SIZE
		{
			get
			{
				return this.lastSIZE;
			}
			set
			{
				this.lastSIZE = value;
			}
		}

	
		[System.Xml.Serialization.XmlIgnoreAttribute()]
		public double OPEN_PRICE
		{
			get
			{
				return this.oPEN_PRICE;
			}
			set
			{
				this.oPEN_PRICE = value;
			}
		}
		[System.Xml.Serialization.XmlIgnoreAttribute()]
		public double CLOSE_PRICE
		{
			get
			{
				return this.cLOSE_PRICE;
			}
			set
			{
				this.cLOSE_PRICE = value;
			}
		}
		[System.Xml.Serialization.XmlIgnoreAttribute()]
		public DateTime TimeLastTransaction
		{
			get
			{
				return this.timeLastTransaction;
			}
			set
			{
				this.timeLastTransaction = value;
			}
		}
	
		
		[System.Xml.Serialization.XmlIgnoreAttribute()]
		public string Symbol
		{
			get
			{
				return this.symbol;
			}
			set
			{
				this.symbol = value;
			}
		}
		[System.Xml.Serialization.XmlIgnoreAttribute()]
		public Int64 VolumeTotal
		{
			get
			{
				return this.volumeTotal;
			}
			set
			{
				this.volumeTotal = value;
			}
		}

	
		[System.Xml.Serialization.XmlIgnoreAttribute()]
		public int AskSize
		{
			get
			{
				return this.askSize;
			}
			set
			{
				this.askSize = value;
			}
		}
		[System.Xml.Serialization.XmlIgnoreAttribute()]
		public int BidSize
		{
			get
			{
				return this.bidSize;
			}
			set
			{
				this.bidSize = value;
			}
		}
		[System.Xml.Serialization.XmlIgnoreAttribute()]
		public int WKN
		{
			get
			{
				return this.wkn;
			}
			set
			{
				this.wkn = value;
			}
		}
		

		[System.Xml.Serialization.XmlIgnoreAttribute()]
		public int TickType
		{
			get
			{
				return this.tickType;
			}
			set
			{
				this.tickType = value;
			}

		}
		public static string SetTickString(TickTypeEnum tickType)
		{
			switch (tickType)
			{
				case TickTypeEnum.BID_SIZE :
				{
					return "bidSize";
				}
				case TickTypeEnum.BID_PRICE :
				{
					return "bidPrice";
				}
				case TickTypeEnum.ASK_PRICE :
				{
					return "askPrice";
				}
				case TickTypeEnum.ASK_SIZE :
				{
					return "askSize";
				}
			
				case TickTypeEnum.LAST_SIZE :
				{
					return "lastSize";
				}
				case TickTypeEnum.LAST_PRICE :
				{
					return "lastPrice";
				}
				case TickTypeEnum.HIGH :
				{
					return "high";
				}
				case TickTypeEnum.LOW :
				{
					return "lOW";
				}
				case TickTypeEnum.VOLUME :
				{
					return "VOLUME";
				}
				case TickTypeEnum.CLOSE_PRICE :
				{
					return "close";
				}
			
				default:
				{
					return "unknown";
				}

           

			}
		}
		#endregion

		#region Interface IQuote - IComparable
	
		public new object Clone()
		{
			//Share is lowest common Element
			return this.MemberwiseClone() as IQuoteBase;
		}

	
		#endregion

		public bool SetTickData(int tickType, object val)
		//public void SetTickData(TickTypeEnum tickType, object val)

		{
			switch (tickType)
			{
				case 0:
				{
					this.bidSize = (int)val ;
					break;
				}
				case 1:
				{
					this.bid = (double)val ;
					break;
					
				}
				case 2:
				{
					this.ask = (double)val ;
					break;
				}
				case 3 :
				{
					this.askSize = (int)val ;
					break;
				}
			
				case 4 :
				{
					this.lastSIZE = (int)val ;
					break;
				}
				case 5 :
				{
					this.lastPrice = (double)val ;
					break;
				}
				case 9 :
				{
					this.cLOSE_PRICE = (double)val ;
					return true;

				}
			
				default:
				{
					return false;
				}


					

			}
			return false;

		}
           
           
        
	}
}
